<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <!--范例https://developer.mozilla.org/zh-CN/docs/Learn/CSS/Building_blocks/Styling_tables-->
    <style>
      table {
        table-layout: fixed;
        width: 100%;
        border-collapse: collapse;
        border: 3px solid purple;

      }

      thead th:nth-child(1) {
        width: 30%;
      }

      thead th:nth-child(2) {
        width: 20%;
      }

      thead th:nth-child(3) {
        width: 15%;
      }

      thead th:nth-child(4) {
        width: 35%;
      }

      tbody tr:nth-child(odd) {
        background-color: gray;
      }

      tbody tr:nth-child(even) {
        background-color: white;
      }
    </style>
  </head>
  <body>
    <table>
      <caption>
        A summary of the UK's most famous punk bands
      </caption>
      <thead>
        <tr>
          <th scope="col">Band</th>
          <th scope="col">Year formed</th>
          <th scope="col">No. of Albums</th>
          <th scope="col">Most famous song</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th scope="row">Buzzcocks</th>
          <td>1976</td>
          <td>9</td>
          <td>Ever fallen in love (with someone you shouldn't've)</td>
        </tr>
        <tr>
          <th scope="row">The Clash</th>
          <td>1976</td>
          <td>6</td>
          <td>London Calling</td>
        </tr>
        <tr>
          <th scope="row">The Stranglers</th>
          <td>1974</td>
          <td>17</td>
          <td>No More Heroes</td>
        </tr>
      </tbody>
      <tfoot>
        <tr>
          <th scope="row" colspan="2">Total albums</th>
          <td colspan="2">77</td>
        </tr>
      </tfoot>
    </table>
  </body>
</html>
